package com.linkstec.concurrent;

import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
 * 固定数量线程
 * @author 刘路
 *
 */
public class ThreadTest {

	 public static void main(String[] args) {
		 
		 ExecutorService es = Executors.newFixedThreadPool(30);
		 
		 Thread1 thread = new Thread1();
		 es.execute(thread);
		 for(int i = 0;i<=1000;i++){
			 es.execute(new Thread1());
		 }
		 es.shutdown();
	    }
	    private static class Thread1 implements Runnable{
	        @Override
	        public void run(){
	        	Thread t=Thread.currentThread();
//	        	System.out.println(t);
	        	System.out.println(t.getName());
	        }
	    }
}